class Feed::MoneyJoin < Feed
  validates_presence_of :added_money
  validates_presence_of :user_id,
    :money
    
  def before_create
    self.version = 1
    self.added_money = 300
    self.money = 300
  end
  
  def after_create
    user.money = added_money
    user.save(false)
  end
  
  # to template
  def to_t
    ":user于:created_at_ago_in_words前加入麦吐司，获得了:added_money麦粒"
  end
end